This section describes the functions you use to update your windows and to maintain window update regions.
Starts updating a window when you receive an update event for that window.
pascal void BeginUpdate (WindowPtr theWindow);
The BeginUpdate function limits the visible region of the window's graphics port to the intersection of the visible region and the update region; it then sets the window's update region to an empty region. After calling BeginUpdate , your application redraws either the entire content region or only the visible region. In either case, only the parts of the window that require updating are actually redrawn on the screen.
Every call to BeginUpdate must be matched with a subsequent call to EndUpdate (EndUpdate) after your application redraws the content region. BeginUpdate and EndUpdate can't be nested. That is, you must call EndUpdate before the next call to BeginUpdate .
pascal void EndUpdate (WindowPtr theWindow);
The EndUpdate function restores the normal visible region of a window's graphics port. When you receive an update event for a window, you call BeginUpdate (BeginUpdate) , redraw the update region, and then call EndUpdate . Each call to BeginUpdate must be balanced by a subsequent call to EndUpdate .
Adds a rectangle to a window's update region.
pascal void InvalRect (const Rect *badRect);
The InvalRect function adds a specified rectangle to the update region of the window whose graphics port is the current port. Specify the rectangle in local coordinates. The Window Manager clips it, if necessary, to fit in the window's content region.
Both your application and the Window Manager use the InvalRect function. When the user enlarges a window, for example, the Window Manager uses InvalRect to add the newly created content region to the update region. Your application uses InvalRect to add the two rectangles formerly occupied by the scroll bars in the smaller content area.
Removes a rectangle from a window's update region.
pascal void ValidRect (const Rect *goodRect);
The ValidRect function removes a specified rectangle from the update region of the window whose graphics port is the current port. Specify the rectangle in local coordinates. The Window Manager clips it, if necessary, to fit in the window's content region.
Your application uses ValidRect to tell the Window Manager that it has already drawn a rectangle and to cancel any updates accumulated for that area. You can thereby improve response time by reducing redundant redrawing.
Suppose, for example, that you've resized a window that contains a size box and scroll bars. Depending on the dimensions of the newly sized window, the new size box and scroll bar areas may or may not have been accumulated into the window's update region. After calling SizeWindow (SizeWindow) , you can redraw the size box or scroll bars immediately and then call ValidRect for the areas they occupy. If they were in fact accumulated into the update region, ValidRect removes them so that you do not have to redraw them with the next update event.
Removes a specified region from a window's update region.
pascal void ValidRgn (RgnHandle goodRgn);